library OfficerSystemPurge initializer init requires LegacySystem

	private function SystemPurgeConditions takes nothing returns boolean
		return GetSpellAbilityId()=='A01H' and GetRandomInt(1,4)!=1
	endfunction

	private function SystemPurge takes nothing returns nothing
		local unit u = GetSpellTargetUnit()
		call UnitRemoveAbility(u,'Bslo')
		call UnitRemoveAbility(u,'Bapl')
		call UnitRemoveAbility(u,'Bpsd')
		call UnitRemoveAbility(u,'Bpoi')
		call UnitRemoveAbility(u,'BNpa')
		call UnitRemoveAbility(u,'B015')
		call UnitRemoveAbility(u,'B00A')
		set u = null
	endfunction

	private function init takes nothing returns nothing
		local trigger t
		set t = CreateTrigger()
		call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT  )
		call TriggerAddCondition( t, Condition( function SystemPurgeConditions ) )
		call TriggerAddAction(t,function SystemPurge)
	endfunction

endlibrary